from loguru import logger
from conf.settings import LOG_FILE,LOG_LEVEL
import sys

class Log:
    logger.remove()
    # level: 日志级别, file.path: 文件(程序)
    # 路径.line: 日志行号, function: 所属日志函数名, message: 日志体, module
    fmt ='[{time}][{level}][{file.path}:line:{line}:function_name:{function}] ||msg={message}'
    logger.add(sys.stdout,level=LOG_LEVEL,format=fmt)#控制台输出日志
    logger.add(LOG_FILE,level=LOG_LEVEL,format=fmt,encoding='utf-8',enqueue=True,rotation='1 day',retention='10 days')#生成日志文件

    debug = logger.debug
    info = logger.info
    warning = logger.warning
    error = logger.error

if __name__ == "__main__":
    Log.info("日志测试")